package com.example.springbootweb_comprehensiveexample.mapper;

import com.example.springbootweb_comprehensiveexample.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeptMapper {

    //查询全部部门信息
    @Select("select * from dept")
    List<Dept> list();

    //删除部门信息
    @Delete("delete from dept where id = #{id}")
    void delete(Integer id);

    //添加部门
    @Insert("insert into dept(name, create_time, update_time) values(#{name}, #{createTime}, #{updateTime})")
    void insert(Dept dept);

    //更新部门
     //1.根据id查询部门
    @Select("select * from dept where id = #{id}")
    Dept selectById(Integer id);

    void update(Dept dept);
}
